(1) Field of the Invention
The invention relates to multi-tasking operating systems, more particularly, to methods and apparatus for CPU cycle stealing on a non-preemptive multi-tasking operating system.
(2) Prior Art
With a non-preemptive, multi-tasking operating system, several applications share access to the computer's central processing unit (CPU). An operating system is multi-tasking if it allows more than one program/application to run at the same time at the user's discretion. In particular, Microsoft Windows.RTM. operating system is a cooperative non-preemptive operating system.
In a preemptive operating system, the operating system keeps track of how much time each application gets by distributing the CPU time allocated to each application that is running. In contrast, in a cooperative non-preemptive operating system, the operating system does not keep track of time spent by each application running in a multi-tasking environment. Typically, the operating system performs the scheduling of applications in a simple round robin type scheme. Consequently, a cooperative non-preemptive operating system may not allow the most efficient distribution of CPU time for applications requiring a certain amount of CPU cycles, such as those executing in real time.
Existing methods allowing an application running on a non-preemptive multi-tasking operating system to steal CPU cycle time include the use of an interrupt handler. A computer system typically has a timer chip which transmits an electrical signal at predetermined periods. A timer interrupt handler incorporating the timer chip allows some cycle stealing per predetermined time period. A disadvantage of using a hardware interrupt handler is that when a program runs in the interrupt context, significant restrictions are imposed on what the program can do, which must be satisfied or the whole system may be corrupted. For example, many O.S. API (operating system application programming interface) calls are not allowed.
Existing methods of sharing the CPU clock cycles on a non-preemptive multi-tasking O.S., including the interrupt handler method and the round robin scheme of sharing CPU time, are not only extremely inefficient and inconvenient for an operating system running multiple applications on a single PC, but vastly affects the perceived quality of transmission of data between more than one PC, one or more at a local station and one or more at a remote station all sharing the same application.
For example, a computer running applications one, two, and three, running on a non-preemptive multi-tasking operating system such as Microsoft Windows.RTM., may transmit data over a network to a second computer, computer two, also running application one, along with other applications on a non-preemptive multi-tasking operating system such as Microsoft Windows.RTM.. Application one on computer one communicating with application one on computer two would not be able to maintain a smooth, quick flow of data when the other applications running on computer one and computer two are scheduled to run on either the round robin scheme or are initiated by a timer interrupt handler. Further, application one on computer one and computer two would have to wait for its turn to run and only then could application one send and/or receive data.
Thus, without the basic ability for an application to steal CPU cycle time from other concurrently running applications, a non-preemptive multi-tasking operating system, may not produce desired results, especially with natural data types such as audio and video data which may not be sent and received in a user- perceived timely manner.
As one of the backbones and foundations of impending and now popular technology involving communication between multiple computers, a method and an apparatus which allow an application running on a non-preemptive multi-tasking operating system to steal CPU cycles from concurrently running applications providing for a more efficient and practical real time response of data between computers are desired.